<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Course extends Model
{

    protected $table = 'course';
    public $timestamps = true;
    protected $dateFormat = 'U';

    //查询今天的课程
    public static function getCourse(){
        $start = strtotime(Carbon::now()->startOfDay());
        $end = strtotime(Carbon::now()->endOfDay());
        $res = self::whereBetWeen('class_start_time',[$start,$end])
         ->pluck('team_id')->toArray();
        return $res ?? '';
    }
    //对应关系
    public function team()
    {
        return $this->hasOne('App\Models\Team','id','team_id');
    }

}
